Import Libraries
library(Hmisc)
## Warning: package 'ggplot2' was built under R version 3.3.2
library(dplyr)
library(plyr)
library(xlsx)
library(reshape2)
library(tidyr)
## Warning: package 'tidyr' was built under R version 3.3.2
require(ggplot2)
#Clears everything (useful when not knitting and testing things in the console)
rm(list=ls())
The resulting contours (scores) are then normalised to the range of −1 to +1 and median filtered (with a width of 3 samples). Then, in order to attenuate the effect of a different interpretations of the scale, the normalised and filtered ratings are standardised to the average standard deviation of all anno- tators.
Load Data
Initialize Graph Paramaters
center_title <- theme(plot.title = element_text(hjust = 0.5))
theme = theme(legend.position="none", panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"))
Histograms (Time Invariant)
for (xvalue in labelnames) {
print(
ggplot(AVEC, aes_string(x=xvalue)) + geom_histogram(alpha=.6) + theme_bw() + ggtitle(xvalue) + center_title +
xlim(-1,1)
)
}
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1 rows containing missing values (geom_bar).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1 rows containing missing values (geom_bar).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1 rows containing missing values (geom_bar).
for (xvalue in labelnames) {
print(
ggplot(AVEC, aes_string(x=xvalue, fill = "instancename")) + geom_histogram() + theme_bw() + ggtitle(xvalue) + center_title +
xlim(-1,1) + theme + facet_wrap(~instancename)
)
}
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 48 rows containing missing values (geom_bar).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 48 rows containing missing values (geom_bar).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 48 rows containing missing values (geom_bar).
Labels by Timestamp (split by participant)
for (yvalue in labelnames) {
xvalue = "timestamp"
print(
ggplot(AVEC, aes_string(x=xvalue, y=yvalue)) + geom_line() + theme_bw() + ggtitle(paste(yvalue,"by",xvalue)) + center_title +
facet_wrap(~instancename) + theme
)
}
Summary Function
pSummary <- summarySE(AVEC, measurevar="arousal", groupvars=c("instancename"))
ggplot(pSummary, aes(x=instancename, y=arousal, colour=instancename)) + theme_bw() +
geom_point(position=position_dodge(), stat="identity") +
geom_errorbar(aes(ymin=arousal-sd, ymax=arousal+sd),
width=.2, # Width of the error bars
position=position_dodge(.9)) +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) + theme
## Warning: Width not defined. Set with `position_dodge(width = ?)`
pSummary <- summarySE(AVEC, measurevar="valence", groupvars=c("instancename"))
ggplot(pSummary, aes(x=instancename, y=valence, colour=instancename)) + theme_bw() +
geom_point(position=position_dodge(), stat="identity") +
geom_errorbar(aes(ymin=valence-sd, ymax=valence+sd),
width=.2, # Width of the error bars
position=position_dodge(.9)) +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) + theme
## Warning: Width not defined. Set with `position_dodge(width = ?)`
pSummary <- summarySE(AVEC, measurevar="liking", groupvars=c("instancename"))
ggplot(pSummary, aes(x=instancename, y=liking, colour=instancename)) + theme_bw() +
geom_point(position=position_dodge(), stat="identity") +
geom_errorbar(aes(ymin=liking-sd, ymax=liking+sd),
width=.2, # Width of the error bars
position=position_dodge(.9)) +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) + theme
## Warning: Width not defined. Set with `position_dodge(width = ?)`
Relationship Between Label Names (repeats because I’m too lazy to fix the loops)
for (yvalue in labelnames) {
for (xvalue in labelnames) {
if (xvalue != yvalue) {
print(
ggplot(AVEC, aes_string(x=xvalue, y=yvalue)) + geom_point(size=.5) + theme_bw() + ggtitle(paste(yvalue,"by",xvalue)) + center_title +
facet_wrap(~instancename) + theme
)
}
}
}